package com.nju.edu.android_app;

import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

import com.weibo.sdk.android.util.BitmapHelper;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.widget.ImageView.ScaleType;

public class StreamItem {
	Bitmap mBitmap;
	Bitmap image=null;
	final String mLine1;
	final String mLine2;
	final long id;
	final String source;

	public StreamItem(Context c, String resid, String resid2, String line1,
			String line2, long id,String source) {
		mBitmap = getBitmap(resid);
		if (resid2 != null)
			image = getBitmap(resid2);
		mLine1 = line1;
		mLine2 = line2;
		this.id = id;
		this.source=source;
	}

	public static Bitmap getBitmap(String str) {
		Bitmap result = null;
//		try {
//			URL url = new URL(str);
//			HttpURLConnection conn = (HttpURLConnection) url.openConnection();
//			conn.setDoInput(true);
//			conn.connect();
//			InputStream inputStream = conn.getInputStream();
//			BitmapFactory.Options opts = new BitmapFactory.Options();
//			opts.inSampleSize = 4;
//			result = BitmapFactory.decodeStream(inputStream);
//			inputStream.close();
//		} catch (Exception e) {
//			// TODO: handle exception
//			System.out.println(e);
//		}
		return result;
	}
}
